package cn.bdqn.service.impl;

import cn.bdqn.entity.City;
import cn.bdqn.dao.CityDao;
import cn.bdqn.service.CityService;
import org.springframework.stereotype.Service;
import java.util.List;
import javax.annotation.Resource;

@Service
public class CityServiceImpl implements CityService {
    @Resource
    private CityDao cityDao;

    @Override
    public List<City> queryAll() {
        return this.cityDao.queryAll();
    }
    
    @Override
    public City queryById(Integer cityId) {
        return this.cityDao.queryById(cityId);
    }
    @Override
    public City insert(City city) {
        this.cityDao.insert(city);
        return city;
    }

    @Override
    public City update(City city) {
        this.cityDao.update(city);
        return this.queryById(city.getCityId());
    }

    @Override
    public boolean deleteById(Integer cityId) {
        return this.cityDao.deleteById(cityId) > 0;
    }
}
